package root.electronclass.electronclass.mvp.base;


import com.google.gson.annotations.Expose;

/**
 * 继承响应类（重写）
 */
public class BaseResponse<T> {
    @Expose
    private int code;
    @Expose
    private T rows;
    @Expose
    private String msg;
    @Expose
    private boolean success;
    @Expose
    private int total;


    public BaseResponse(int code, T rows, String msg, boolean success, int total) {
        this.code = code;
        this.rows = rows;
        this.msg = msg;
        this.success = success;
        this.total = total;
    }

    public T getRows() {
        return rows;
    }

    public void setRows(T rows) {
        this.rows = rows;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public boolean isSuccess() {
        return success || code == 200;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "BaseResponse{" +
                "code=" + code +
                ", rows=" + rows +
                ", msg='" + msg + '\'' +
                ", success=" + success +
                ", total=" + total +
                '}';
    }
}


